<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'stu.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link href="DataUI/css/lyz.calendar.css" rel="stylesheet" type="text/css" />

<script src="http://www.jq22.com/jquery/1.4.4/jquery.min.js"></script>

<script src="DataUI/js/lyz.calendar.min.js" type="text/javascript"></script>
<style type="text/css">
	tr td{
		border: 1px solid #ccc;

		text-align: center;
	}
	.t1{
		background: #ccc;
		font-weight: bold;
	}
	select {
		width: 150px;
	}
}
</style>
<script>

    $(function () {

        $("#stubirth").calendar({

            controlId: "divDate",                                 // 弹出的日期控件ID，默认: $(this).attr("id") + "Calendar"

            speed: 200,                                           // 三种预定速度之一的字符串("slow", "normal", or "fast")或表示动画时长的毫秒数值(如：1000),默认：200

            complement: true,                                     // 是否显示日期或年空白处的前后月的补充,默认：true

            readonly: true,                                       // 目标对象是否设为只读，默认：true

            upperLimit: new Date(),                               // 日期上限，默认：NaN(不限制)

            lowerLimit: new Date("1960/01/01"),                   // 日期下限，默认：NaN(不限制)



        });

        $("#enrolment").calendar();
        $("#graduation").calendar();

    });
    
    
    $(function(){
    	$("#department").change(function(){
    	var a=$("#department").val();
    		$.ajax({
    		data:"mid="+a,
    		
    		success:function(msg){
    			var item;
    			 $('#major').empty();			      				     				         
				$.each(msg,function(i,result){
					 if(i==0)
					 {
					 	 item="<option value='-1'>请选择</option>"; 									         					         
			         	 $('#major').append(item);
					 }						  					       						    
			         item="<option value="+result.mid+">"+result.mname+"</option>"; 									         					         
			         $('#major').append(item);							         							         						 	
				     								    								     						    							   			    						    												
				});		
    		},
    		type:"post",
    		url:"student/queryMId"
    		})
    	})
    	
    	
    	
    	$("#major").change(function(){
    	var a=$("#major").val();
    		$.ajax({
    		data:"mid="+a,
    		
    		success:function(msg){
    			$('#money1').empty();
    			$('#money2').empty();
    			$('#money3').empty();
    			$('#money4').empty();
    			$('#money5').empty();
    			$('#money6').empty();
    			$('#money7').empty();
    			$('#money8').empty();
    			$('#summoney1').empty();
    			$('#summoney2').empty();
    			$.each(msg,function(i,result){
					if(result.mid==a)
					{
						var sum=result.mprice+result.tprice+result.aprice+result.lprice						         					         
			         	$('#money1').append("专业费");	
			         	$('#money2').append("教学费");
			         	$('#money3').append("住宿费");
			         	$('#money4').append("学杂费");
			         	$('#money5').append(result.mprice+"元");
			         	$('#money6').append(result.tprice+"元");
			         	$('#money7').append(result.aprice+"元");
			         	$('#money8').append(result.lprice+"元");
			         	$('#summoney1').append("总费用");
			         	$('#summoney2').append(sum+"元");
					}	
										  					       						       								    								     						    							   			    						    												
				});		
    					      				     				         
				
    		},
    		type:"post",
    		url:"student/queryById"
    		})
    	})
    
    });

</script>
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    <form action="student/save" method="post">
    	<table style="border: 1px solid #ccc;width: 900px;height:500px; margin-left: 100px;margin-top: 50px;" cellpadding="0" cellspacing="0">
    	<tr><td colspan="8"><h1>学生注册登记表</h1></td></tr>
    		<tr>
    			<td class="t1">姓名</td>
    			<td class="t2"><input type="text" id="stuname" name="stuname"></td>
    			<td class="t1">性别</td>
    			<td class="t2">
    				<input type="radio" name="stusex" id="stusex" value="男">男
    				<input type="radio" name="stusex" id="stusex" value="女">女
    			</td>
    			<td class="t1">民族</td>
    			<td class="t2"><input type="text" name="nation" id="nation"></td>
    			<td class="t1">学号</td>
    			<td class="t2"><input type="text" name="stuno" id="stuno"></td>
    		</tr>
    		<tr>
    			<td class="t1">出生年月日</td>
    			<td class="t2"><input id="stubirth" name="stubirth"/></td>
    			<td class="t1">籍贯</td>
    			<td class="t2"><input type="text" name="address" id="address"></td>
    			<td class="t1">身份证号</td>
    			<td class="t2"><input type="text" name="identification" id="identification"></td>
    			<td class="t1">学校名称</td>
    			<td class="t2"><input type="text" name="school" id="school"></td>
    		</tr>
    		<tr>
    			<td class="t1">系别</td>
    			<td class="t2">
    				<select id="department" name="department">
    					<option>请选择</option>
    					<c:forEach items="${majorList }" var="m">
    						<c:if test="${m.fatherid==0 }">
    							<option value="${m.mid }">${m.mname }</option>
    						</c:if>
    					</c:forEach>
    				</select>
    			</td>
    			<td class="t1">教育层次</td>
    			<td class="t2">
	    			<select id="arrangement" name="arrangement">
	    				<option value="专科">专科</option>
	    				<option value="本科">本科</option>
	    			</select>
    			</td>
    			<td class="t1">学制</td>
    			<td class="t2">
    				<select name="length" id="length">
    					<option value=3>3年</option>
    					<option value=4>4年</option> 
    				</select>
    			</td>
    			<td class="t1">教育形式</td>
    			<td class="t2">
    				<select name="form" id="form">
    					<option value="普通全日制">普通全日制</option>
    					<option value="成人教育">成人教育</option> 
    				</select>
    			</td>
    		</tr>

    		<tr>
    			<td class="t1">专业</td>
    			<td>
    				<select id="major" name="classid">
    					<option value="-1">请选择</option>
    				</select>
    			</td>
    			<td class="t1">入学时间</td>
    			<td class="t2"><input id="enrolment" name="enrolment"/></td>
    			<td class="t1">毕业时间</td>
    			<td class="t2"><input id="graduation" name="graduation"/></td>
    		</tr>
    		<tr>
    			<td style="background-color:#ccc;height: 60px;font-weight: bold;" rowspan="2">费用构成</td>
    			<td id="money1"></td>
    			<td id="money2" colspan="2"></td>
    			<td id="money3"></td>
    			<td id="money4" colspan="2"></td>
    			<td id="summoney1"></td>
    		</tr>
    		<tr>
    			<td id="money5"></td>
    			<td id="money6" colspan="2"></td>
    			<td id="money7"></td>
    			<td id="money8" colspan="2"></td>
    			<td id="summoney2"></td>
    		</tr>
    		<tr>
    			<td colspan="8"><input type="submit" value="保存"></td>
    		</tr>
    	</table>
    </form>
  </body>
</html>
